home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mint110s / makefile.lcc < prev    next >
Makefile  |  1993-08-16  |  7KB  |  234 lines

  1. #
  2. # Makefile for MiNT using the LCC
  3. #
  4.  
  5. # if you're cross-compiling, define NATIVECC
  6. # to the host's C compiler, NATIVECFLAGS to
  7. # the appropriate flags for it, and NATIVELIBS
  8. # to appropriate libraries
  9. # NATIVECC = cc -DNO_STDLIB
  10. # NATIVECFLAGS = -g
  11. # NATIVELIBS =
  12.  
  13. NATIVECC = lcc
  14. NATIVECFLAGS = -O
  15. NATIVELIBS =
  16.  
  17. #
  18. # depending on your version of bison/yacc, you may
  19. # need to change these names, e.g. to
  20. # YACC = yacc
  21. # YTABC = y.tab.c
  22. # YTABH = y.tab.h
  23.  
  24. YACC = bison -d
  25. YTABC = asm_tab.c
  26. YTABH = asm_tab.h
  27.  
  28. # here are defs for the cross compiler
  29. # MiNT must be compiled with 16 bit integers
  30.  
  31. CC = lcc
  32. AS = asm
  33. MODEL = -w -b0 -r0 -bn -aw
  34. MODEL030 = $(MODEL) -m3
  35. LIBS =
  36.  
  37. # add -DMULTITOS for a MultiTOS kernel
  38. # add -DONLY030 for a version of MiNT that needs a 680x0, x>=3
  39. # add -DDEBUG_INFO for debugging information
  40.  
  41. DEFS = -DDEBUG_INFO
  42. DEFS030 = -DONLY030 -DDEBUG_INFO
  43.  
  44. SYMS = -Hmint.sym
  45. SYMS030 = -Hmint030.sym
  46.  
  47. # 30    - pointers do not point to same type of object
  48. # 86    - formal definitions conflict with type list
  49. # 100    - no prototype declared for function
  50. # 104    - conversion from pointer to const/volatile to pointer to non-const/volatile
  51. # 135    - assignment to shorter data type (precision may be lost)
  52. # 154    - no prototype declared for function pointer
  53. # 159    - use of unary minus on unsigned value
  54. ERRORS = -j30e86e100e104e135i154e159i
  55.  
  56. OPTS = -d1 -Oloop -v -cfsb -cag -e
  57. ASOPTS = -ma -m8 -d -.
  58. COPTS = $(OPTS) $(MODEL) $(ERRORS) $(DEFS)
  59. CFLAGS = $(COPTS) $(SYMS)
  60. ASFLAGS = $(ASOPTS) $(DEFS)
  61. COPTS030 = $(OPTS) $(MODEL030) $(ERRORS) $(DEFS030)
  62. CFLAGS030 = $(COPTS030) $(SYMS030)
  63. ASFLAGS030 = -m3 $(ASOPTS) $(DEFS030)
  64.  
  65. LDFLAGS = -t=
  66.  
  67. COBJS = main.o bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o \
  68.     dossig.o filesys.o mem.o proc.o signal.o timeout.o tty.o util.o \
  69.     biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \
  70.     unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o realloc.o
  71.  
  72. COBJS030 = main.o0 bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 \
  73.     dossig.o0 filesys.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
  74.     biosfs.o0 pipefs.o0 procfs.o0 tosfs.o0 debug.o0 rendez.o0 \
  75.     unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o0 realloc.o0
  76.  
  77. CSRCS = main.c bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c \
  78.     dossig.c filesys.c mem.c proc.c signal.c timeout.c tty.c util.c \
  79.     biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \
  80.     unifs.c shmfs.c fasttext.c welcome.c nalloc2.c memprot.c realloc.c
  81.  
  82. SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o
  83. SOBJS030 = context.o0 intr.o0 syscall.o0 quickzer.o0 quickmov.o0 cpu.o0
  84.  
  85. OBJS = $(COBJS) $(SOBJS)
  86. OBJS030 = $(COBJS030) $(SOBJS030)
  87.  
  88. all: mint.prg mint030.prg
  89.  
  90. mint.prg: $(OBJS)
  91.     $(CC) $(CFLAGS) -omint.prg $(LDFLAGS) $(OBJS) $(LIBS)
  92.  
  93. mint030.prg: $(OBJS030)
  94.     $(CC) $(CFLAGS030) -omint030.prg $(LDFLAGS) $(OBJS030) $(LIBS)
  95.  
  96. $(SOBJS) $(SOBJS030): proc.h
  97. $(COBJS): mint.sym
  98. $(COBJS030): mint030.sym
  99.  
  100. main.o: version.h
  101. welcome.o: version.h
  102. bios.o: inline.h
  103.  
  104. memprot.o: memprot.c
  105.     $(CC) -c $(CFLAGS) -m3 -omemprot.o memprot.c
  106.  
  107. main.o0: version.h
  108. welcome.o0: version.h
  109. bios.o0: inline.h
  110.  
  111. mint.sym mint030.sym: mint.h ctype.h assert.h atarierr.h basepage.h types.h \
  112.     signal.h mem.h proc.h file.h sproto.h proto.h inline.h
  113.  
  114. mint.sym:
  115.     $(CC) $(COPTS) -ph -omint.sym mint.h
  116.  
  117. mint030.sym:
  118.     $(CC) $(COPTS030) -ph -omint030.sym mint.h
  119.  
  120. #
  121. # assembler source files are now handled in a radically different
  122. # fashion. We build a pre-processor program, asmtrans, that
  123. # takes the .spp files, merges them with an include file that
  124. # gives various offsets into structures of interest, and produces
  125. # the .s files as output. This has two major advantages:
  126. # (1) it lets us use the same source for both the Lattice and
  127. #     gcc assembler files (the translator will convert), and
  128. # (2) if we change the CONTEXT or PROC structures, we don't
  129. #     have to dig through the source code looking for
  130. #     magic numbers
  131.  
  132. # the asm translator program
  133. # Note that this must be compiled with the native CC of whatever
  134. # system you're using; see the definitions at the top of this
  135. # file.
  136.  
  137. ATRANSOBJ = asmtab.o trutil.o trans.o
  138. ATRANS = asmtrans.ttp
  139.  
  140. $(ATRANS): $(ATRANSOBJ)
  141.     $(NATIVECC) $(NATIVECFLAGS) -o $(ATRANS) $(ATRANSOBJ) \
  142.         $(NATIVELIBS)
  143.  
  144. asmtab.o: asmtab.c asmtrans.h
  145.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c asmtab.c
  146.  
  147. trutil.o: trutil.c asmtrans.h
  148.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trutil.c
  149.  
  150. trans.o: trans.c asmtrans.h
  151.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trans.c
  152.  
  153.  
  154. asmtab.c asmtab.h:    asm.y
  155.     $(YACC) asm.y
  156.     mv $(YTABC) asmtab.c
  157.     mv $(YTABH) asmtab.h
  158.  
  159. # the magic number include file is generated automagically
  160. # NOTE that of course, magic.i can only reliably be generated
  161. # on an Atari ST; if you're cross-compiling, you'll have
  162. # to edit magic.i by hand
  163. # for cross compilers; uncomment the following definitions
  164. # and comment out the other ones below
  165.  
  166. # for cross-compiling
  167.  
  168. # GENMAGICPRG=echo
  169. # magic.i: proc.h file.h genmagic.c
  170. #    echo "Warning: magic.i may be out of date"
  171.  
  172. #for native compiling
  173.  
  174. GENMAGICPRG=genmagic.ttp
  175.  
  176. $(GENMAGICPRG): genmagic.c proc.h file.h
  177.     $(CC) $(CFLAGS) -DGENMAGIC -o $(GENMAGICPRG) genmagic.c
  178.  
  179. magic.i: $(GENMAGICPRG)
  180.     $(GENMAGICPRG) $@
  181.  
  182. #
  183. # assembler source files
  184. #
  185. .SUFFIXES: .spp .o0
  186.  
  187. .spp.o:
  188.     $(ATRANS) $(DEFS) -asm -o $*.s $<
  189.     $(AS) $(ASFLAGS) -o$@ $*.s
  190.     $(RM) $*.s
  191. .spp.o0:
  192.     $(ATRANS) $(DEFS030) -asm -o $*.s $<
  193.     $(AS) $(ASFLAGS030) -o__asm.o $*.s
  194.     mv __asm.o $@
  195.     $(RM) $*.s
  196. .spp.s:
  197.     $(ATRANS) $(DEFS) -asm -o $@ $<
  198. .c.o0:
  199.     $(CC) -c $(CFLAGS030) -o$@ $<
  200.  
  201. context.o context.o0: context.spp magic.i $(ATRANS)
  202. intr.o intr.o0: intr.spp magic.i $(ATRANS)
  203. syscall.o syscall.o0: syscall.spp magic.i $(ATRANS)
  204. quickzer.o quickzer.o0: quickzer.spp $(ATRANS)
  205. quickmov.o quickmov.o0: quickmov.spp $(ATRANS)
  206. cpu.o cpu.o0: cpu.spp $(ATRANS)
  207.  
  208. #
  209. # mkptypes generates prototypes from C source code. If you don't have it,
  210. # you'll have to add/delete function prototypes by hand.
  211. # also: Sozobon users will have to edit proto.h by hand to change the
  212. #    #if defined(__STDC__) || defined(__cplusplus)
  213. # line into
  214. #    #if __STDC__
  215. #
  216. # This is more trouble than its worth, lets forget it for know (lets be
  217. # honest editting proto.h by hand is usually easier...)
  218. #
  219. #proto.h: $(CSRCS)
  220. #    mkptypes $(CSRCS) >proto.h
  221.  
  222. #
  223. # macros for cleaning up
  224. #
  225. GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG) \
  226.     $(YTABC) $(YTABH) magic.i __asm.o genmagic.o
  227. EXTRAS= asmtab.c asmtab.h mint.prg mint030.prg mint.sym mint030.sym
  228.  
  229. clean:
  230.     $(RM) -f $(GENFILES)
  231.  
  232. realclean:
  233.     $(RM) -f $(GENFILES) $(EXTRAS)
  234.